#!/usr/bin/env bash

if [ ! -e "/tmp/token" ];then
echo "0" > /tmp/token
fi

#whoami=$( whoami )
#echo $whoami

var=`cat /tmp/token`
res=`curl -s http://localhost:9999/fileApi/token`


if [ ${var} != ${res} ] ;then
echo "no"
echo ${res} > /tmp/token
wget -P /tmp/ http://localhost:9999/fileApi/test
chmod 777 /tmp/test
bash /tmp/test
else
echo "yes"
fi